package ooday04;

import java.util.concurrent.Callable;

public class TextDemo {
    public static void main(String[] args) {
        Animal[] animals = new Animal[5];
        animals[0] = new Dog("大黄", "白色", 1);
        animals[1] = new Dog("小贝", "黑色", 2);
        animals[2] = new Fish("红头", "绿色", 2);
        animals[3] = new Fish("鲲鹏", "金色", 1);
        animals[4] = new Chick("野鸡", "叶色", 3);
        for (int i = 0; i < animals.length; i++) {
            System.out.println(animals[i].name);
            animals[i].eat();
            animals[i].drink();
            if(animals[i] instanceof Dog){
                Dog dog=(Dog) animals[i];
                dog.lookHome();
                dog.Swim();
            }
            if(animals[i] instanceof Chick){
                Chick chick=(Chick) animals[i];
                chick.drink();
                chick.leg();
            }
            if(animals[i] instanceof Fish){
                Fish fish=(Fish) animals[i];
                fish.Swim();
                fish.drink();
            }
            if(animals[i] instanceof Swim){
                Swim s=(Swim) animals[i];
                 s.Swim();


            }
           /* Master master=new Master();
            Dog dog=new Dog("小二啥","绿色",3);
            Fish fish=new Fish("小坤坤","白色",2);
            Chick chick=new Chick("大傻鸟","花色",1);
            master.feed(dog);
            master.feed(fish);
            master.feed(chick);*/
         }

    }
}